<table class="layui-table" id="select_path_table">
    <colgroup>
        <col width="20%">
        <#if (canChoicePath?string('yes', 'no'))=='yes'>
            <col width="20%">
        </#if>
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>执行路径</th>
        <#if (canChoicePath?string('yes', 'no'))=='yes'>
            <th>选择同步条件后的执行路径</th>
        </#if>
        <th>目标任务</th>
    </tr>
    </thead>

    <#list nodeTranUserList as nodeTranUser>
        <tr>
            <td>
                <#if selectPath==1>
                    <input type="radio" name="destTask" value="${nodeTranUser.nodeId}" title="${nodeTranUser.nodeName}">
                <#else>
                    ${nodeTranUser.nodeName}
                </#if>
            </td>
            <#if (canChoicePath?string('yes', 'no'))=='yes'>
                <td>
                    <#list nodeTranUser.nextPathMap?keys as key>
                        <div>
                            <input type="checkbox" name="nextPathId[${key}]" value="${key}" lay-skin="primary"/>
                                ${nodeTranUser.nextPathMap["${key}"]}
                        </div>
                    </#list>
                </td>
            </#if>
            <td>
                <#if nodeTranUser.nodeUserMapSet??>
                    <a  href="javascript:" onclick="javascript:setInverse(this);" >全选/全不选</a>
                </#if>
                <#list nodeTranUser.nodeUserMapSet as nodeUserMap>
                    <div>
                        ${nodeUserMap.nodeName}
                        <input type="hidden" name="lastDestTaskId[${nodeUserMap.nodeId}]" value="${nodeUserMap.nodeId}"/>
                        <span class= "selectUser" name="spanSelectUser">
                            <#list nodeUserMap.taskExecutors as executor>
                                &nbsp;&nbsp;<input  type="checkbox" name="${nodeUserMap.nodeId}_userId[${executor.executeId}]"  value="${executor.type}^${executor.executeId}^${executor.executor}" lay-skin="primary"/>${executor.executor}
                            </#list>
                        </span>
                        &nbsp;&nbsp;<i class="layui-icon layui-icon-username"><a href="javascript:;" onclick="selExeUsers(this,'${nodeUserMap.nodeId}')">选择...</a></i>
                    </div>
                </#list>
            </td>
        </tr>
    </#list>
</table>
<script>

    layui.use(['form'], function () {
        var form = layui.form;
        form.render();
        var isAllCheck  = false;
        //全选、全不选功能
        setInverse = function (thisObj){
            var lastDestTaskIds = $(thisObj).nextAll().children("input[name^='lastDestTaskId']");
            for(var j=0;j<lastDestTaskIds.length;j++){
                var lastDestTaskId = $(lastDestTaskIds.get(j)).val()+"_userId";
                var inputSelectUser =$("input[name^="+lastDestTaskId+"]");
                for(var i=0;i<inputSelectUser.length;i++){
                    if(isAllCheck){
                        $(inputSelectUser[i]).prop("checked",false);
                        $(inputSelectUser[i]).next().removeClass("layui-form-checked");
                    }else{
                        $(inputSelectUser[i]).prop("checked",true);
                        $(inputSelectUser[i]).next().addClass("layui-form-checked");
                    }
                }
            }
            isAllCheck = !isAllCheck;
        }
    });
</script>